package edu.sctu.practice.class02.yangyuran.assign03.assign3_02;

/**
 * Created by Administrator on 2015/10/23.
 */
public class ComparableCylinder extends Cylinder implements Comparable {
    public ComparableCylinder(double radius, double height) {
        super(radius, height);
    }

    @Override
    public int compareTo(Object o) {
        Cylinder cylinder = (Cylinder) o;
        if (getVolume() > cylinder.getVolume())
            return 1;
        else if (getVolume() < cylinder.getVolume())
            return -1;
        else
            return 0;
    }
}

